home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 43
/
Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso
/
-serious-
/
comms
/
other
/
ftp4all
/
src
/
amigapatch
/
amiga-2.26.diff
next >
Wrap
Text File
|
1999-06-14
|
45KB
|
1,230 lines
diff -urbNB /tmp/differ/ftpd-2.25/CHANGES ./CHANGES
--- /tmp/differ/ftpd-2.25/CHANGES Mon Apr 5 17:03:34 1999
+++ ./CHANGES Thu Jun 3 13:30:52 1999
@@ -1,7 +1,64 @@
VERSION HISTORY
===============
-- Version 2.25b (Release on 27/Mar/19999)
+- Version 2.26a (Released on 02/Jun/1999)
+ + Removed the bug that the logfile was not written at all.
+ + Fixed another small thing you are not interested in.
+ + Changed the behaviour when a .perm-file got 0-size.
+ + FAQ-change regarding GPL.
+
+- Version 2.26 (Released on 30/May/1999)
+[New Features]
+ +bnc4all-support included. You can use the old bouncing method if you
+ specify "rftpdbouncer on" in ftpd.conf. Else the bnc4all-auth-method
+ is used.
+
+[Additional features]
+ +Check and Dupecheck are now available with wildcards, like
+ "check .r* /checkscript" or a global checker with "check * /script".
+ You can even set wildcards like ".*op" but it works ONLY with 3
+ char-extensions (like .r00 or .bin) so a file like "archive.hzop"
+ wouldnt get checked by the daemon. Thanks to BadSec for the patch.
+ +swapreuid() is now taken for proper handling of ports < 1024 and
+ setuid environments. (hey draven :)
+ +the file/dirnameconversion gets another bit. when adding 0x08 or
+ 0x80 to the "filenameconversion" in ftpd.conf you can specify your
+ own characters you don't want to see in your site. This specification
+ is done via "convchars <stringofchars>" somewhere in ftpd.conf.
+ Don't place spaces within this stringofchars.
+ +If you specify "max_add <number>" in ftpd.conf the groups can not get
+ larger than this number. This is only for groupops (that they can't add loads
+ of users to their group), the root is still allowed to do anything.
+ +You can specify now (for groupop as well as for usereditors) the fixed
+ values for limits and credits. Specify in ftpd.conf "groupop_limit <lm>"/
+ "useredit_limit <lm>" (i.e. 33) and "groupop_cred <mb>"/
+ "useredit_cred <mb>" (both in megabytes) and the groupops just can change
+ to this limit, nothing else. For the limits the usual value is 33, for
+ credits 0.
+
+[Bugfixes]
+ +Fixed the problem when a script got executed and the whole site stalls.
+ For fans of background knownledge: we changed the IPC from named pipes
+ (which were a quite old system) to socketpairs and this prevents from
+ stalling in some occasions.
+
+ NOTE: This fix was NOT possible in the AMIGA version due to problems with
+ the BSD-platform of amiga. (senfgurke)
+
+ +Fixed a bug when the pre_upload or pre_download don't give any line in
+ return.
+ +Fixed a bug which occured while building the internal top-list (possible
+ pipe-error). Thanks to BadSec for pointing out and fixing it.
+ +Fixed the bug, when setting "ident off" and idented users couldn't
+ login.
+ +Users now can really list themselfes with "site usr list <username>".
+
+[Miscellanous stuff]
+ +Errors removed which occured due to the loss of prototypes. Removed all
+ warnings while compiling with -Wall (gcc 2.7.2.3). Probably the daemon is
+ now more stable.
+
+- Version 2.25b (Released on 27/Mar/1999)
+Fixed another bug which could have resulted in a floating point exception
at certain events.
diff -urbNB /tmp/differ/ftpd-2.25/FTP4ALL-FAQ ./FTP4ALL-FAQ
--- /tmp/differ/ftpd-2.25/FTP4ALL-FAQ Sun Mar 7 21:16:46 1999
+++ ./FTP4ALL-FAQ Thu Jun 3 13:29:08 1999
@@ -31,9 +31,8 @@
to system shell accounts.
Q: Mhhh... sounds like a great deal, what does it cost ?
- A: FTP4ALL is distributed under the GPL, and is free if you don't use
- it commercially. Please read and understand the conditions of this
- licence.
+ A: FTP4ALL is distributed under the GPL. Please read and understand
+ the conditions of this licence.
Q: Are there any FTP4ALL related limitations ?
A: No, just the normal limitations that applies for user accounts
diff -urbNB /tmp/differ/ftpd-2.25/src/commands.c ./src/commands.c
--- /tmp/differ/ftpd-2.25/src/commands.c Sun Mar 7 21:16:46 1999
+++ ./src/commands.c Thu Jun 3 13:29:08 1999
@@ -24,8 +24,10 @@
#include <unistd.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <string.h>
#include "tweak.h"
#include "externs.h"
+#include "glob_proc.h"
int cmd_smnt(char** p, int n)
{ return send_reply(502,"SMNT command not implemented.");
diff -urbNB /tmp/differ/ftpd-2.25/src/common.c ./src/common.c
--- /tmp/differ/ftpd-2.25/src/common.c Sat Mar 27 16:52:35 1999
+++ ./src/common.c Thu Jun 3 13:29:08 1999
@@ -32,6 +32,8 @@
#include <sys/socket.h>
#include <arpa/inet.h>
#include <signal.h>
+#include <unistd.h>
+#include <sys/wait.h>
#include "tweak.h"
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
@@ -40,6 +42,7 @@
#include <sys/time.h>
#endif
#include "externs.h"
+#include "glob_proc.h"
extern signal_handler(int sig);
diff -urbNB /tmp/differ/ftpd-2.25/src/commondef.h ./src/commondef.h
--- /tmp/differ/ftpd-2.25/src/commondef.h Sun Mar 7 21:16:46 1999
+++ ./src/commondef.h Thu Jun 3 13:31:19 1999
@@ -22,8 +22,8 @@
#ifndef _ftpd_commondef_h
#define _ftpd_commondef_h
-#define VERSION "2.25 (07/Mar/1999)"
-#define SVERSION "2.25"
+#define VERSION "2.26a AMIGA (02/Jun/1999)"
+#define SVERSION "2.26"
struct group_s
{ char name[10];
diff -urbNB /tmp/differ/ftpd-2.25/src/configd.c ./src/configd.c
--- /tmp/differ/ftpd-2.25/src/configd.c Sun Mar 7 21:16:46 1999
+++ ./src/configd.c Thu Jun 3 13:29:08 1999
@@ -27,12 +27,16 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
#include "tweak.h"
#ifdef DES_ENCRYPTION
#include "des.h"
#endif
#include "externsd.h"
+int parse_command(char* p, char** param, int max, int* n);
+
void* alloc(void* buf, long size)
{ if (buf) return realloc(buf,size); else return malloc(size);
}
@@ -781,7 +785,7 @@
long get_rights(char *p, long* value, char *line)
{ long v;
- int n;
+ char n;
char *q;
*value=0;
@@ -789,8 +793,9 @@
while (skipspace(&p))
{ v = 0;
q = p;
+ n = 0;
if (skipnspace(&q)) *(q++) = '\0';
- if (n = (*p == '!')) p++;
+ if (*p == '!') { n = 1; p++; }
if (!strcasecmp(p,"all")) v = R_ALL; else
if (!strcasecmp(p,"enable")) v |= R_ENABLE; else
if (!strcasecmp(p,"disable")) v |= R_DISABLE; else
@@ -816,9 +821,10 @@
{ sprintf(line,"Unknown right: %s",p);
return -1;
}
- if (n) *value &= ~v; else *value |= v;
+ if (n == 1) *value &= ~v; else *value |= v;
p = q;
}
+ return 0;
}
int load_config_file(const char* filename, FILE** file, char* line, int* lineno,
@@ -957,8 +963,9 @@
while (skipspace(&p))
{ v = 0;
q = p;
+ n = 0;
if (skipnspace(&q)) *(q++) = '\0';
- if (n = (*p == '!')) p++;
+ if (*p == '!') { n = 1; p++; }
if (!strcasecmp(p,"all")) v = LG_ALL; else
if (!strcasecmp(p,"cd")) v |= LG_CD; else
if (!strcasecmp(p,"chmod")) v |= LG_CHMOD; else
@@ -971,7 +978,7 @@
if (!strcasecmp(p,"put")) v |= LG_PUT; else
if (!strcasecmp(p,"rd")) v |= LG_RD; else
if (!strcasecmp(p,"ren")) v |= LG_REN; else return -1;
- if (n) logc &= ~v; else logc |= v;
+ if (n == 1) logc &= ~v; else logc |= v;
p = q;
}
} else if (!strcasecmp(p,"logfile"))
@@ -1112,6 +1119,16 @@
{ if (get_string(q,&pre_download) == -1) return -1;
} else if (!strcasecmp(p,"checktimeout"))
{ if (get_integer(q,&checktimeout,0,100) == -1) return -1;
+ } else if (!strcasecmp(p,"rftpdbouncer"))
+ { if (get_onoff(q,&rftpdbouncer) == -1) return -1;
+ } else if (!strcasecmp(p,"convchars"))
+ { if (get_string(q,&convchars) == -1) return -1;
+ } else if (!strcasecmp(p,"max_added"))
+ { if (get_integer(q,&max_added,0,100) == -1) return -1;
+ } else if (!strcasecmp(p,"useredit_cred"))
+ { if (get_integer(q,&useredit_cred,0,100) == -1) return -1;
+ } else if (!strcasecmp(p,"groupop_cred"))
+ { if (get_integer(q,&groupop_cred,0,100) == -1) return -1;
} else
return -1;
}
diff -urbNB /tmp/differ/ftpd-2.25/src/dir.c ./src/dir.c
--- /tmp/differ/ftpd-2.25/src/dir.c Sun Mar 7 21:16:46 1999
+++ ./src/dir.c Thu Jun 3 13:29:08 1999
@@ -25,9 +25,11 @@
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
+#include <unistd.h>
#include "tweak.h"
#include "externs.h"
#include "perm.h"
+#include "glob_proc.h"
int show_readmefile(void)
{ FILE* file;
diff -urbNB /tmp/differ/ftpd-2.25/src/externs.h ./src/externs.h
--- /tmp/differ/ftpd-2.25/src/externs.h Sun Mar 7 21:19:37 1999
+++ ./src/externs.h Thu Jun 3 13:29:08 1999
@@ -38,6 +38,7 @@
extern int chmodallowed;
extern int close_reason;
extern char close_server;
+extern char* convchars;
extern char cwd[256];
extern struct check_s* dcheck;
extern int dcheck_count;
diff -urbNB /tmp/differ/ftpd-2.25/src/externsd.h ./src/externsd.h
--- /tmp/differ/ftpd-2.25/src/externsd.h Sun Mar 7 21:16:46 1999
+++ ./src/externsd.h Thu Jun 3 13:29:08 1999
@@ -61,6 +61,7 @@
extern int child_size;
extern int children;
extern char chmodallowed;
+extern char* convchars;
extern struct check_s* dcheck;
extern int dcheck_count;
extern int dcheck_size;
@@ -83,6 +84,7 @@
extern char* group_file;
extern int group_size;
extern int groupop_limit;
+extern int groupop_cred;
extern long groupop_rights;
extern char ident_mode;
extern struct msg_s list_msg;
@@ -95,6 +97,7 @@
extern int login_kick;
extern int login_kick_signo;
extern int login_retries;
+extern int max_added;
extern int max_anon;
extern int max_anon_domain;
extern int max_anon_ip;
@@ -112,6 +115,7 @@
extern char* program_name;
extern char* readme_file;
extern char resolver;
+extern char rftpdbouncer;
extern char* script_path;
extern char server_closed;
extern char* server_dir;
@@ -143,6 +147,7 @@
extern char* user_file;
extern int user_size;
extern int useredit_limit;
+extern int useredit_cred;
extern long useredit_rights;
extern char wait_port;
extern struct msg_s welcome_msg;
diff -urbNB /tmp/differ/ftpd-2.25/src/ff.c ./src/ff.c
--- /tmp/differ/ftpd-2.25/src/ff.c Sun Mar 7 21:16:46 1999
+++ ./src/ff.c Thu Jun 3 13:29:08 1999
@@ -27,6 +27,7 @@
#include <sys/stat.h>
#include "tweak.h"
#include "externs.h"
+#include "glob_proc.h"
int cmd_site_ff_syntax(int rno)
{ return send_reply(rno,
@@ -85,6 +86,7 @@
void convert_filename(char* filename, int mode)
{ char* name;
+ char* tmp;
if (!mode) return;
name = filename + strlen(filename);
@@ -109,6 +111,14 @@
}
if (mode & 0x04) while (*filename)
{ if (isspace(*filename)) *filename = '_';
+ filename++;
+ }
+ if (mode & 0x08) while (*filename)
+ { tmp = convchars;
+ while (*tmp)
+ { if (*filename == *tmp) *filename = '_';
+ tmp++;
+ }
filename++;
}
}
diff -urbNB /tmp/differ/ftpd-2.25/src/ftpd.c ./src/ftpd.c
--- /tmp/differ/ftpd-2.25/src/ftpd.c Sun Mar 7 21:16:46 1999
+++ ./src/ftpd.c Thu Jun 3 13:29:08 1999
@@ -31,6 +31,7 @@
#include <unistd.h>
#include <netinet/in.h>
#include <sys/socket.h>
+#include <arpa/inet.h>
#include <sys/wait.h>
#include "tweak.h"
#ifdef HAVE_SYS_SELECT_H
@@ -43,6 +44,17 @@
#include "des.h"
#endif
#include "globalsd.h"
+#include "glob_procd.h"
+
+int write_user_file(const char* filename, FILE* file);
+int write_group_file(const char* filename);
+void child_logout(struct child_s* c, int exitcode);
+int in_iprange(long ip, char* iprange);
+int in_ident(long ip, char* ident, char* iprange);
+void print_configuration(void);
+void child_communication(struct child_s* c);
+void server_log_local(struct child_s* c, long l, char* str, ...);
+char *rfc931(struct sockaddr_in* rmt_sin,struct sockaddr_in* our_sin);
int send_reply(int s, int rno, char* buffer)
{ char msg[8];
@@ -63,7 +75,7 @@
if ((file = fopen(filename,"wt")) == NULL) return -1;
for (i=0; i<user_count; i++, u++)
- { fprintf(file,"%s:%li:%li:%s:%li:%li:%li:*.*.*.*:%li:%s:0x%02lX:%li",
+ { fprintf(file,"%s:%li:%li:%s:%li:%li:%li:*.*.*.*:%i:%s:0x%02lX:%li",
u->name,u->uid,u->gid,u->password,u->kb_downloaded,u->kb_uploaded,
u->last_login,u->limit,u->info,u->class,u->credit);
first = 1;
@@ -117,7 +129,7 @@
strcpy(tstr,group_file ? group_file : ".groups");
strcat(tstr,".bak");
rename(group_file ? group_file : ".groups",tstr);
- write_user_file(user_file ? user_file : ".users");
+ write_user_file(user_file ? user_file : ".users",NULL);
write_group_file(group_file ? group_file : ".groups");
time(&t);
strftime(tstr,sizeof(tstr),"%a %b %d, %Y %H:%M:%S",localtime(&t));
@@ -132,7 +144,7 @@
if (log_pid) fclose(log_program_f);
exit(e);
case SIGUSR1 :
- write_user_file(user_file ? user_file : ".users");
+ write_user_file(user_file ? user_file : ".users",NULL);
write_group_file(group_file ? group_file : ".groups");
if (logf) fflush(logf);
fflush(errlogf);
@@ -260,17 +272,18 @@
unsigned long int oi;
short cn;
int reuse_addr = 1;
- char bounced_idnt[256];
+ char bounced_idnt[255];
char bounced_user[10];
struct sockaddr_in bounced_addr;
int use_bouncer = 0;
+ char auth[4];
#ifndef HAVE_SIGSET
sigfillset(&sig_act.sa_mask);
sig_act.sa_flags = SA_RESTART;
#define sigset(x,y) sig_act.sa_handler = y; sigaction(x,&sig_act,NULL)
#endif
- printf("FTP4ALL "VERSION", Copyright (C) 1996,1997 by Christoph Schwarz\n");
+ printf("FTP4ALL "VERSION", Copyright (C) 1996,1997,1998,1999 by Crescent\n");
#ifdef DEBUG
debugf = fopen("ftp4all-debug","wt");
if (!debugf)
@@ -327,6 +340,7 @@
else { srv_addr.sin_addr.s_addr = inet_addr(other_ip); }
srv_addr.sin_port = htons((u_short)port);
bzero(srv_addr.sin_zero, sizeof srv_addr.sin_zero);
+ swapreuid();
while (port && bind(ss,(struct sockaddr*)&srv_addr,sizeof(srv_addr)) == -1)
{ if (errno == EADDRINUSE)
{ if (wait_port)
@@ -343,7 +357,7 @@
return errno;
}
}
-
+ swapreuid();
if (NULL != bouncer)
{ bouncer_ip.sin_addr.s_addr = inet_addr(bouncer);
if (bouncer_ip.sin_addr.s_addr == -1 ) {
@@ -435,12 +449,22 @@
if (NULL != bouncer)
{
if (rem_addr.sin_addr.s_addr == bouncer_ip.sin_addr.s_addr)
- {
- read(cs, bounced_idnt, sizeof bounced_idnt);
- bounced_addr.sin_addr.s_addr = inet_addr(strstr(bounced_idnt, "@")+1);
- strtok(bounced_idnt, "@");
- strcpy(bounced_user, strchr(bounced_idnt, ' ')+1);
+ { bzero(bounced_idnt,sizeof(bounced_idnt));
+ read(cs, bounced_idnt, sizeof(bounced_idnt));
+#ifdef DEBUG
+ fprintf(debugf,"AUTH STR : %s",bounced_idnt);
+#endif
+ if (rftpdbouncer == 1) strncpy(auth,"IDNT",4); else strncpy(auth,"AUTH",4);
+ if (strncmp(bounced_idnt,auth,4) != 0)
+ { close(cs);
+ use_bouncer = 0;
+ cs = -1;
+ } else
+ { bounced_addr.sin_addr.s_addr = inet_addr(strstr(bounced_idnt,"@")+1);
+ strtok(bounced_idnt,"@");
+ strcpy(bounced_user,strchr(bounced_idnt,' ')+1);
use_bouncer = 1;
+ }
} else
{ hp = gethostbyaddr((char*)&rem_addr.sin_addr,sizeof(rem_addr.sin_addr), AF_INET);
use_bouncer = 0;
@@ -522,6 +546,7 @@
if (0 == strcmp(bounced_user, "unknown"))
strncpy(child_new->ident, "UNKNOWN", 7);
else memcpy(child_new->ident,bounced_user,strlen(bounced_user)+1);
+ send_reply(cs,220,"Authorization OK, proceed login with USER");
} else
{ child_new->ip = ntohl(rem_addr.sin_addr.s_addr);
memcpy(child_new->ident,idnt,strlen(idnt)+1);
@@ -536,7 +561,8 @@
close(cs);
}
} else
- { hp = gethostbyaddr((char*)&rem_addr.sin_addr,sizeof(rem_addr.sin_addr),
+ { if (use_bouncer) send_reply(cs,530,"Authorization FAILED, closing connection");
+ hp = gethostbyaddr((char*)&rem_addr.sin_addr,sizeof(rem_addr.sin_addr),
AF_INET);
server_log_local(NULL,LG_LOGIN,"UNAUTHORIZED CONNECTION from %s@%s (%s)",
idnt, inet_ntoa(rem_addr.sin_addr),hp ? hp->h_name : "unknown host");
diff -urbNB /tmp/differ/ftpd-2.25/src/ftps.c ./src/ftps.c
--- /tmp/differ/ftpd-2.25/src/ftps.c Sun Mar 7 21:16:46 1999
+++ ./src/ftps.c Thu Jun 3 13:29:08 1999
@@ -30,6 +30,7 @@
#include <sys/socket.h>
#include "tweak.h"
#include "globals.h"
+#include "glob_proc.h"
void* alloc(void* buf, long size)
{ if (buf) return realloc(buf,size); else return malloc(size);
@@ -85,7 +86,7 @@
printf("+\n");
g = group;
for (i=0; i<group_count; i++)
- { if (scanf("%s %i",&g->name,&g->gid) != 2)
+ { if (scanf("%s %li",g->name,&g->gid) != 2)
{ fprintf(stderr,"ftps(%i): error reading group list.\n",getpid());
exit(-1);
}
@@ -113,7 +114,7 @@
printf("+\n");
u = user;
for (i=0; i<user_count; i++)
- { if (scanf("%s %i",&u->name,&u->uid) != 2)
+ { if (scanf("%s %li",u->name,&u->uid) != 2)
{ fprintf(stderr,"ftps(%i): error reading user list.\n",getpid());
quit(CL_PIPEERR);
exit(-1);
@@ -449,7 +450,7 @@
sigset(SIGTERM,signal_handler);
setvbuf(stdout,NULL,_IOLBF,0);
printf("SIN\n");
- scanf("%i %i %i %i %i %li %i %li %i %li %i %i %i %i ",&num_anon,&max_anon,
+ scanf("%i %i %i %i %i %li %i %li %c %li %i %i %i %i ",&num_anon,&max_anon,
&num_users,&max_users,&login_kick,&other_ip_s,&login_retries,&logc,&touch,&ipaddr,
&sock,&fconv_mode,&chmodallowed,&checktimeout);
get_string(&permission_file,str,sizeof(str));
@@ -459,6 +460,7 @@
get_string(&script_path,str,sizeof(str));
get_string(&pre_download,str,sizeof(str));
get_string(&pre_upload,str,sizeof(str));
+ get_string(&convchars,str,sizeof(str));
if (!get_message("MSU",&message,&msg_len,&msg_size)) return close_reason;
if (!get_message("MCU",&cdup_msg,NULL,NULL)) return close_reason;
if (!get_message("MCD",&chdir_msg,NULL,NULL)) return close_reason;
@@ -476,11 +478,11 @@
get_dupecheck();
get_dshortcut(&dshortcut);
if ((sockfr = fdopen(sock,"rt")) == NULL)
- { fprintf(stderr,"ftps(%i): socket fdopen failed\n");
+ { fprintf(stderr,"ftps(%i): socket fdopen failed\n",getpid());
return CL_SOCKERR;
}
if ((sockf = fdopen(sock,"wt")) == NULL)
- { fprintf(stderr,"ftps(%i): socket fdopen failed\n");
+ { fprintf(stderr,"ftps(%i): socket fdopen failed\n",getpid());
return CL_SOCKERR;
}
setvbuf(sockf,NULL,_IOLBF,0);
diff -urbNB /tmp/differ/ftpd-2.25/src/glob_proc.h ./src/glob_proc.h
--- /tmp/differ/ftpd-2.25/src/glob_proc.h Thu Jan 1 01:00:00 1970
+++ ./src/glob_proc.h Thu Jun 3 13:29:08 1999
@@ -0,0 +1,50 @@
+/* glob_proc.h
+ *
+ * This file is part of FTP4ALL
+ *
+ * Copyright (C) 1996,1997,1998,1999 by Christoph Schwarz
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _ftps_glob_proc_h
+#define _ftps_glob_proc_h
+
+int send_reply(int rno, char* reply);
+int add_dir(char* src, char* dir, char* dest, int maxlen);
+void client_activity(char* str, ...);
+void client_log_start(long lno, char* str, ...);
+void client_log_finish(long lno, char* str, ...);
+void client_log(long lno, char* str, ...);
+void client_log_error(long lno);
+int read_ftp_command(char* buffer, int bufferlen, char** param, int max, int* n);
+int send_error(int rno, char* cmd, long lno);
+int read_file_permission(char* dir,char* name,long* uid,long* gid,long* perm);
+int send_message(int rno, int finish, char* buffer, char* str);
+void quit(int reason);
+int run_program(char* prog, char** param, int n, int rno, int finish, char* cd,
+ int* exitcode, char* buffer);
+int wildcard_matching(char* wildcard, char* filename, int csens);
+void convert_filename(char* filename, int mode);
+int read_permission_file(char* dir, long* uid, long* gid, long* perm,
+ long* dlc, char** buffer, int* n);
+int write_permission_file(char* dir, long uid, long gid, long perm);
+int permission_part_ok(char* dir, int p, int uidok);
+int remove_permission_file(char* dir);
+long dirperm_to_fileperm(long perm);
+int parse_command(char* p, char** param, int max, int* n);
+int get_message(char* cmd, char** message, int* msg_len, int* msg_size);
+
+#endif
diff -urbNB /tmp/differ/ftpd-2.25/src/glob_procd.h ./src/glob_procd.h
--- /tmp/differ/ftpd-2.25/src/glob_procd.h Thu Jan 1 01:00:00 1970
+++ ./src/glob_procd.h Thu Jun 3 13:29:08 1999
@@ -0,0 +1,29 @@
+/* glob_procd.h
+ *
+ * This file is part of FTP4ALL
+ *
+ * Copyright (C) 1996,1997,1998,1999 by Christoph Schwarz
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _ftps_glob_procd_h
+#define _ftps_glob_procd_h
+
+int load_config(const char* filename, int reconfig);
+
+#endif
+
+/* EOF */
diff -urbNB /tmp/differ/ftpd-2.25/src/globals.h ./src/globals.h
--- /tmp/differ/ftpd-2.25/src/globals.h Sun Mar 7 21:19:47 1999
+++ ./src/globals.h Thu Jun 3 13:29:08 1999
@@ -39,6 +39,7 @@
int chmodallowed = 1;
int close_reason = CL_ERROR;
char close_server = 0;
+char* convchars = NULL;
char cwd[256] = "/";
struct check_s* dcheck = NULL;
int dcheck_count = 0;
@@ -93,7 +94,16 @@
FILE* sockfr;
char structure = S_FILE;
int timeout = 60;
-struct top_s top[10] = { 0,0,0,0,0,0,0,0,0,0,0,0 };
+struct top_s top[10] = { {"",0,"","",0,"","",0,"","",0,"" },
+ {"",0,"","",0,"","",0,"","",0,"" },
+ {"",0,"","",0,"","",0,"","",0,"" },
+ {"",0,"","",0,"","",0,"","",0,"" },
+ {"",0,"","",0,"","",0,"","",0,"" },
+ {"",0,"","",0,"","",0,"","",0,"" },
+ {"",0,"","",0,"","",0,"","",0,"" },
+ {"",0,"","",0,"","",0,"","",0,"" },
+ {"",0,"","",0,"","",0,"","",0,"" },
+ {"",0,"","",0,"","",0,"","",0,"" } };
char touch = 0;
char type = T_ASCII;
long umask_value;
@@ -101,7 +111,7 @@
struct user_s* user = NULL;
int user_count = 0;
int user_size = 0;
-struct user_f_s usr = { 0,0,0,0,0,0,0,0,0,0 };
+struct user_f_s usr = { "",0,0,0,0,0,0,0,{0,0,0,0,0,0,0,0},0 };
#endif
diff -urbNB /tmp/differ/ftpd-2.25/src/globalsd.h ./src/globalsd.h
--- /tmp/differ/ftpd-2.25/src/globalsd.h Sun Mar 7 21:16:46 1999
+++ ./src/globalsd.h Thu Jun 3 13:29:08 1999
@@ -61,6 +61,7 @@
int child_size = 0;
int children = 0;
char chmodallowed = 1;
+char* convchars = NULL;
struct check_s* dcheck = NULL;
int dcheck_count = 0;
int dcheck_size = 0;
@@ -84,6 +85,7 @@
char* group_file = NULL;
int group_size = 0;
int groupop_limit = 33;
+int groupop_cred = 0;
long groupop_rights = 0;
char ident_mode = 0;
struct msg_s list_msg = { NULL,0,NULL,0,0,default_list_msg };
@@ -96,6 +98,7 @@
int login_kick = 0;
int login_kick_signo = SIGKILL;
int login_retries = 10;
+int max_added = 0;
int max_anon = 10;
int max_anon_domain = 10;
int max_anon_ip = 10;
@@ -113,6 +116,7 @@
char* program_name = NULL;
char* readme_file = NULL;
char resolver = 1;
+char rftpdbouncer = 0;
char* script_path = NULL;
char server_closed = 0;
char* server_dir = NULL;
@@ -144,6 +148,7 @@
char* user_file = NULL;
int user_size = 0;
int useredit_limit = 33;
+int useredit_cred = 0;
long useredit_rights = 0;
char wait_port = 0;
struct msg_s welcome_msg = { NULL,0,NULL,0,0,default_welcome_msg };
diff -urbNB /tmp/differ/ftpd-2.25/src/list.c ./src/list.c
--- /tmp/differ/ftpd-2.25/src/list.c Sun Mar 7 21:16:46 1999
+++ ./src/list.c Thu Jun 3 13:29:08 1999
@@ -29,6 +29,8 @@
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <ctype.h>
+#include <unistd.h>
#include "tweak.h"
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
@@ -37,6 +39,7 @@
#include <sys/time.h>
#endif
#include "externs.h"
+#include "glob_proc.h"
#define LS_DOT 0x01
#define LS_LONG 0x02
@@ -368,19 +371,19 @@
return -1;
}
if (FD_ISSET(sock,&fdset_r))
- { switch (read_ftp_command(sock,str,sizeof(str),&p,8,&n))
+ { switch (read_ftp_command(str,sizeof(str),p,8,&n))
{ case -1 :
free(buffer);
return -1;
case 0 :
if (strcasecmp(*p,"ABOR"))
- { if (send_reply(sock,503,"Unexpected command.") == -1)
+ { if (send_reply(503,"Unexpected command.") == -1)
{ free(buffer);
return -1;
}
} else
{ free(buffer);
- send_reply(sock,426,"Transfer interrupted on request.");
+ send_reply(426,"Transfer interrupted on request.");
return 1;
}
}
diff -urbNB /tmp/differ/ftpd-2.25/src/login.c ./src/login.c
--- /tmp/differ/ftpd-2.25/src/login.c Sun Mar 7 21:16:46 1999
+++ ./src/login.c Thu Jun 3 13:29:08 1999
@@ -23,8 +23,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "tweak.h"
#include "externs.h"
+#include "glob_proc.h"
int cmd_user(char** p, int n)
{ int anon_login;
diff -urbNB /tmp/differ/ftpd-2.25/src/perm.c ./src/perm.c
--- /tmp/differ/ftpd-2.25/src/perm.c Sun Mar 7 21:16:46 1999
+++ ./src/perm.c Thu Jun 3 13:29:08 1999
@@ -26,9 +26,11 @@
#include <string.h>
#include <time.h>
#include <utime.h>
+#include <unistd.h>
#include <sys/stat.h>
#include "tweak.h"
#include "externs.h"
+#include "glob_proc.h"
int superuser(void)
{ return !(usr.class & 0x03);
@@ -286,6 +288,8 @@
{ fclose(file);
return -1;
}
+ if (0 == st.st_size)
+ return -1;
if (st.st_size < sizeof(struct perm_s))
{ if (buffer && n)
{ *n = 0;
diff -urbNB /tmp/differ/ftpd-2.25/src/serverd.c ./src/serverd.c
--- /tmp/differ/ftpd-2.25/src/serverd.c Sun Mar 7 21:16:46 1999
+++ ./src/serverd.c Thu Jun 3 13:29:08 1999
@@ -34,12 +34,21 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <arpa/inet.h>
+#include <unistd.h>
+#include <ctype.h>
#include <syslog.h>
#include "tweak.h"
#ifdef DES_ENCRYPTION
#include "des.h"
#endif
#include "externsd.h"
+#include "glob_procd.h"
+
+int groupop(struct user_s* u);
+int useredit(struct user_s* u);
+char skipspace(char** x);
+char skipnspace(char** x);
+int get_iprange(char** ipr, char* ident);
struct user_s* insert_user(struct user_s*);
@@ -121,6 +130,16 @@
if (sscanf(name,"%li",&i)) return i; else return -1;
}
+int group_user_count(struct user_s* us)
+{ int i;
+ int count = 0;
+ struct user_s* tmp = user;
+
+ for (i=0;i<user_count;i++,tmp++) if (us->gid == tmp->gid) count++;
+ return count;
+}
+
+
struct group_s* get_group_by_gid(long gid)
{ struct group_s* g = group;
int i;
@@ -344,6 +363,11 @@
return;
}
+ if ((!superuser(c->user) && (max_added != 0)) && (groupop(c->user) && (group_user_count(c->user) >= max_added)))
+ { server_reply(c,"-You are not allowed to add more users.");
+ return;
+ }
+
/* Name */
if (strlen(*p) >= sizeof(usr.name))
{ server_reply(c,"-User name too long");
@@ -352,7 +376,8 @@
strcpy(usr.name,*p);
/* Group */
- g = get_group_by_name(*(p+1));
+ if ((superuser(c->user) || useredit(c->user)) && (!groupop(c->user)))
+ { g = get_group_by_name(*(p+1));
if (g==NULL)
{ if (sscanf(*(p+1),"%i",&temp)) g = get_group_by_gid(temp);
if (g==NULL)
@@ -361,6 +386,7 @@
}
}
usr.gid=g->gid;
+ } else usr.gid = c->user->gid;
/* Password */
*salt = salt_a[time(NULL) % 64];
@@ -368,13 +394,13 @@
strcpy(usr.password,crypt(*(p+2),salt));
/* Limit */
- if (!allowed(c->user,R_USER_CHANGE_RATIO))
+ if (!superuser(c->user))
{ if (groupop(c->user)) usr.limit = groupop_limit;
else if (useredit(c->user)) usr.limit = useredit_limit;
/* Should never happen */
else usr.limit = 33;
} else
- { if (!strcasecmp(*(p+3),"leech")) usr.limit = 0;
+ { if (strcasecmp(*(p+3),"leech")) usr.limit = 0;
else if (sscanf(*(p+3),"1:%i",&temp)) usr.limit = 100 / temp;
else if (sscanf(*(p+3),"%i",&temp)) usr.limit = temp;
else
@@ -513,7 +539,7 @@
}
void print_ident(char* s, char* ident)
-{ if (*ident!='\0') sprintf(s,"%s@",ident); else sprintf(s,"");
+{ if (*ident!='\0') sprintf(s,"%s@",ident); else bzero(s,sizeof(s));
print_iprange(s+strlen(s),ident);
}
@@ -580,7 +606,7 @@
first = 0;
}
if (first) fprintf(file,":0.0.0.0");
- fprintf(file,":%li:%s:0x%02lX:%li",u->limit,u->info,u->class,u->credit);
+ fprintf(file,":%i:%s:0x%02lX:%li",u->limit,u->info,u->class,u->credit);
first = 1;
for (j=0; j<8; j++) if (u->gids[j] != -1)
{ fprintf(file,"%c%li",first ? ':' : ',' ,u->gids[j]);
@@ -1080,7 +1106,7 @@
{ server_reply(c,"-You are not superuser.");
return;
}
- if (n!=2 || !sscanf(*p,"%li",&gid) || strlen(*(p+1))>=sizeof(g->name))
+ if (n!=2 || !sscanf(*p,"%i",&gid) || strlen(*(p+1))>=sizeof(g->name))
{ server_reply(c,"-Syntax: GROUP CHANGE <gid> <name>");
return;
}
@@ -1145,7 +1171,7 @@
{ server_reply(c,"-You are not superuser.");
return;
}
- if (n!=1 || !sscanf(*p,"%li",&gid))
+ if (n!=1 || !sscanf(*p,"%i",&gid))
{ server_reply(c,"-Syntax: GRM <gid>");
return;
}
@@ -1194,7 +1220,7 @@
if (strlen(str) == 18) strcat(str," (none)");
server_reply(c,str); return;
}
- if ((n == 2) && (**(p+1) == '+') || (**(p+1) == '-'))
+ if ((n == 2) && ((**(p+1) == '+') || (**(p+1) == '-')))
{ gid = get_gid(*(p+1)+1);
if (gid == -1)
{ server_reply(c,"-Group does not exist.");
@@ -1296,9 +1322,9 @@
{ l = (strlen(cdpath+ofs) + 8) & ~0x07;
if (!strcmp(*p,cdpath+ofs))
{ ofs += l;
- sscanf(*(p+1),"%li",cdpath+ofs);
- sscanf(*(p+2),"%li",cdpath+ofs+sizeof(long));
- sscanf(*(p+3),"%li",cdpath+ofs+(sizeof(long)*2));
+ sscanf(*(p+1),"%li",(long*)(cdpath+ofs));
+ sscanf(*(p+2),"%li",(long*)(cdpath+ofs+sizeof(long)));
+ sscanf(*(p+3),"%li",(long*)(cdpath+ofs+(sizeof(long)*2)));
return;
}
ofs += l + (sizeof(long) * 3);
@@ -1400,9 +1426,9 @@
top_d[i] ? top_d[i]->name : "*nobody*",
top_d[i] ? top_d[i]->kb_downloaded : 0,
top_e[i] ? top_e[i]->name : "*nobody*",
- top_e[i] ? (float)(top_e[i]->kb_uploaded*100)/top_e[i]->kb_downloaded : 0,
+ (top_e[i] && top_e[i]->kb_downloaded) ? (float)(top_e[i]->kb_uploaded*100)/top_e[i]->kb_downloaded : 0,
top_l[i] ? top_l[i]->name : "*nobody*",
- top_l[i] ? (float)(top_l[i]->kb_uploaded*100)/top_l[i]->kb_downloaded : -1,
+ (top_l[i] && top_l[i]->kb_downloaded) ? (float)(top_l[i]->kb_uploaded*100)/top_l[i]->kb_downloaded : -1,
top_u[i] ? top_u[i]->name : "*nobody*",
top_u[i] ? top_u[i]->kb_uploaded : 0);
server_reply(c,str);
@@ -1513,6 +1539,7 @@
server_reply(c,script_path ? script_path : "\n");
server_reply(c,pre_download ? pre_download : "\n");
server_reply(c,pre_upload ? pre_upload : "\n");
+ server_reply(c,convchars ? convchars : "\n");
}
void send_upload_msg(struct child_s* c, char** p, int n)
@@ -1722,6 +1749,7 @@
if (children > n) memmove(c,c+1,(children-n)*sizeof(struct child_s));
if (!children) num_anon = num_users = 0;
if (user_file) write_user_file(user_file,NULL);
+ if (group_file) write_group_file(group_file);
}
@@ -1761,6 +1789,10 @@
{ server_reply(c,"-You are not superuser.");
return;
}
+ if ((!superuser(c->user) && (max_added != 0)) && (groupop(c->user) && (group_user_count(c->user) >= max_added)))
+ { server_reply(c,"-You are not allowed to add more users.");
+ return;
+ }
if (su && !superuser(c->user))
{ server_reply(c,"-You can not add superusers.");
return;
@@ -2170,7 +2202,7 @@
{ server_reply(c,"-You are not allowed to change that information.");
return;
}
- if (sscanf(ep,"%li",&i))
+ if (sscanf(ep,"%i",&i))
{ if ( i >= 0 && i <= 9 )
{ strcpy(ep,"0.0.0.0");
if (get_iprange(&ep,u->idents[i]) != 0) se=1;
@@ -2181,7 +2213,9 @@
{ server_reply(c,"-You are not allowed to change that information.");
return;
}
- if (sscanf(ep,"%li",&i)) u->limit = i; else se = 1;
+ if (groupop(c->user)) u->limit = groupop_limit;
+ else if (useredit(c->user)) u->limit = useredit_limit;
+ else if (sscanf(ep,"%i",&i)) u->limit = i; else se = 1;
} else if (!strcasecmp(*p,"INFO"))
{ if (!allowed(c->user,R_USER_CHANGE_OTHER))
{ server_reply(c,"-You are not allowed to change that information.");
@@ -2193,13 +2227,23 @@
{ server_reply(c,"-You are not allowed to change that information.");
return;
}
- if (sscanf(ep,"%li",&l)) u->credit = l; else se = 1;
+ if (groupop(c->user))
+ { if (sscanf(ep,"%li",&l))
+ { if (l < (groupop_cred * 1024)) u->credit = l; }
+ else se = 1;
+ }
+ else if (useredit(c->user))
+ { if (sscanf(ep,"%li",&l))
+ { if (l < ( useredit_cred * 1024)) u->credit = l; }
+ else se = 1;
+ }
+ else if (sscanf(ep,"%li",&l)) u->credit = l; else se = 1;
} else if (!strcasecmp(*p,"CREDIT+"))
{ if (!allowed(c->user,R_USER_CHANGE_STATS))
{ server_reply(c,"-You are not allowed to change that information.");
return;
}
- if (sscanf(ep,"%li",&l)) u->credit += l; else se = 1;
+ if (!groupop(c->user)) if (sscanf(ep,"%li",&l)) u->credit += l; else se = 1;
} else if (!strcasecmp(*p,"CREDIT-"))
{ if (!allowed(c->user,R_USER_CHANGE_STATS))
{ server_reply(c,"-You are not allowed to change that information.");
@@ -2211,13 +2255,13 @@
{ server_reply(c,"-You are not allowed to change that information.");
return;
}
- if (sscanf(ep,"%li",&l)) u->credit = l * 1024; else se = 1;
+ if (!groupop(c->user)) if (sscanf(ep,"%li",&l)) u->credit = l * 1024; else se = 1;
} else if (!strcasecmp(*p,"MBCRED+"))
{ if (!allowed(c->user,R_USER_CHANGE_STATS))
{ server_reply(c,"-You are not allowed to change that information.");
return;
}
- if (sscanf(ep,"%li",&l)) u->credit += l * 1024; else se = 1;
+ if (!groupop(c->user)) if (sscanf(ep,"%li",&l)) u->credit += l * 1024; else se = 1;
} else if (!strcasecmp(*p,"MBCRED-"))
{ if (!allowed(c->user,R_USER_CHANGE_STATS))
{ server_reply(c,"-You are not allowed to change that information.");
@@ -2395,7 +2439,7 @@
{ server_reply(c,"-Syntax: USER LIST [<options>] [<user>|<group>]");
return;
}
- if (!allowed(c->user,R_USER_LIST) && (g || us))
+ if (!allowed(c->user,R_USER_LIST) && (c->user != us) && (!g || !us))
{ server_reply(c,"-You cannot list users except yourself.");
return;
}
@@ -2420,12 +2464,12 @@
else if (templateuser(u)) ch = 't'; else if (groupop(u)) ch = 'g';
else if (useredit(u)) ch = 'e'; else ch = 'n';
grpe = get_group_by_gid(u->gid);
- sprintf(str,"+%-9s %-9s %c%c %c%c%c %1i %3li %3li %7li %7li ",
- u->name, grpe?grpe:NULL , u->password[0] ? ' ' : '*',ch,
+ sprintf(str,"+%-9s %-9s %c%c %c%c%c %1li %3li %3li %7li %7li ",
+ u->name, grpe->name?grpe->name:NULL , u->password[0] ? ' ' : '*',ch,
invisible(u) ? 'i' : '-', coloruser(u) ? 'c' : '-', no_pass_change(u) ? 'p' : '-',
(u->class & 0x70)>>4,u->uid,u->gid,
u->kb_downloaded / 1024, u->kb_uploaded / 1024);
- sprintf(str+strlen(str),"%3li %7li ",u->limit,u->credit / 1024);
+ sprintf(str+strlen(str),"%3i %7li ",u->limit,u->credit / 1024);
if (u->last_login!=0) {
strftime(str+strlen(str),sizeof(str)-strlen(str),"%d/%m %H:%M",
localtime(&u->last_login));
@@ -2569,7 +2613,7 @@
{
if (in_iprange(ip, iprange))
{ if (*iprange=='\0' || *iprange=='*') return 1; else
- { if (strcmp(ident, iprange)==0) return 1; else return 0;
+ { if ((0 == ident_mode) || (strcmp(ident, iprange)==0)) return 1; else return 0;
}
} return 0;
}
@@ -3106,7 +3150,7 @@
return;
}
#ifdef DEBUG
- fprintf(debugf,"child command",*p);
+ fprintf(debugf,"child command");
for (i = 0; i < n; i++) fprintf(debugf," %s",*(p+i));
fprintf(debugf,"\n");
i = 0;
diff -urbNB /tmp/differ/ftpd-2.25/src/site.c ./src/site.c
--- /tmp/differ/ftpd-2.25/src/site.c Sun Mar 7 21:16:46 1999
+++ ./src/site.c Thu Jun 3 13:29:08 1999
@@ -30,13 +30,19 @@
#include <sys/signal.h>
#include <sys/stat.h>
#include <sys/wait.h>
+#include <sys/socket.h>
#include "tweak.h"
#include "externs.h"
+#include "glob_proc.h"
struct file_s* find_name(struct file_s*,char*,int,int*);
struct dirent* findfirst(DIR**,char*,char*);
struct dirent* findnext(DIR*,char*);
+char skipnspace(char** x);
+char skipspace(char** x);
+void endfind(DIR* d);
+
int cmd_site_adduser_syntax(int rno)
{ return send_reply(rno,
"Syntax: ADDUSER <name> <group|gid> <password> <1:ratio|limit|leech> <ip0> [<ip1> [<ip2> [...]]]\n"
@@ -262,7 +268,7 @@
return send_reply(250,"CHMOD command finished.");
}
-int site_chmod_rec(char* path, int file, int who, char cmd, long mode)
+void site_chmod_rec(char* path, int file, int who, char cmd, long mode)
{ DIR* d;
struct dirent* de;
long dperm;
@@ -583,7 +589,7 @@
struct stat st;
dir = opendir(path);
- if (!dir) return;
+ if (!dir) return 0;
strcat(path,"/");
name = path + strlen(path);
while ((d = readdir(dir)) != NULL)
diff -urbNB /tmp/differ/ftpd-2.25/src/transfer.c ./src/transfer.c
--- /tmp/differ/ftpd-2.25/src/transfer.c Mon Apr 5 17:01:15 1999
+++ ./src/transfer.c Thu Jun 3 13:29:08 1999
@@ -31,6 +31,7 @@
#include <unistd.h>
#include <netinet/in.h>
#include <sys/socket.h>
+#include <arpa/inet.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <setjmp.h>
@@ -43,9 +44,13 @@
#endif
#include "externs.h"
#include "perm.h"
+#include "glob_proc.h"
jmp_buf scriptabortjmp;
+int run_prog_xt(char* prog, char **param, int* exitcode, char* returner);
+int find_dupe(char* filename, char* dir);
+
void alarmhandler(int sig)
{ scriptabort = 1;
longjmp(scriptabortjmp,1);
@@ -100,6 +105,7 @@
{ strftime(dir,sizeof(dir),"%Y%m%d%H%M%S",localtime(&st.st_mtime));
return send_reply(213,dir);
} else send_message(550,1,"%s: not a plain file.",*p);
+ return 0;
}
int cmd_size(char** p, int n)
@@ -113,6 +119,7 @@
{ sprintf(dir,"%li",st.st_size);
return send_reply(213,dir);
} else send_message(550,1,"%s: not a plain file.",*p);
+ return 0;
}
int cmd_rest(char** p, int n)
@@ -132,7 +139,7 @@
return ((size / 1024) <= usr.credit);
}
-cmd_transferpermitted(char* prog,char* buffer)
+int cmd_transferpermitted(char* prog,char* buffer)
{ char str[255];
int ec;
char* p[8];
@@ -140,14 +147,14 @@
p[0] = prog;
p[1] = buffer;
- if (run_prog_xt(prog,p,&ec,&str) == -1) return 0;
+ if (run_prog_xt(prog,p,&ec,str) == -1) return 0;
if (WIFEXITED(ec))
{ if (WEXITSTATUS(ec) && (WEXITSTATUS(ec) != -1)) ec = 550; else ec = 150;
} else ec = 150;
if (ec == 550)
{ sprintf(buffer,"Transfer initial check failed (%s).",str);
- if (*buffer) if (send_message(ec,ec == 550,buffer) == -1) return -1;
+ if (*buffer) if (send_message(ec,ec == 550,buffer,NULL) == -1) return -1;
}
return ec == 550 ? 1 : 0;
}
@@ -349,8 +356,8 @@
char* p[8];
void (*oldvec)();
- for (i=0; i<check_count; i++, ch++) if (!strcasecmp(name+strlen(name)-
- strlen(ch->extension),ch->extension))
+ for (i=0; i<check_count; i++, ch++) if (wildcard_matching(ch->extension, name+strlen(name)-
+ strlen(ch->extension), 0))
{ if (add_dir(cwd,dir,buffer,512) == -1) return 0;
i = 0;
p[i++] = ch->name;
@@ -372,7 +379,7 @@
{ if (WEXITSTATUS(i) && (WEXITSTATUS(i) != -1)) i = 550; else i = 226;
} else i = 226;
if ((i == 550) && !*buffer) strcpy(buffer,"File is corrupt.");
- if (*buffer) if (send_message(i,i == 550,buffer) == -1) return -1;
+ if (*buffer) if (send_message(i,i == 550,buffer,NULL) == -1) return -1;
if (i == 550)
{ add_dir(cwd,dir,buffer,512);
add_dir(buffer,name,buffer,512);
@@ -388,8 +395,8 @@
int i;
char* p[8];
- for (i=0; i<dcheck_count; i++, ch++) if (!strcasecmp(name+strlen(name)-
- strlen(ch->extension),ch->extension))
+ for (i=0; i<dcheck_count; i++, ch++) if (wildcard_matching(ch->extension, name+strlen(name)-
+ strlen(ch->extension), 0))
{ i = 0;
p[i++] = ch->name;
if (*ch->param) p[i++] = ch->param;
@@ -400,7 +407,7 @@
{ if (WEXITSTATUS(i) && (WEXITSTATUS(i) != -1)) i = 550; else i = 150;
} else i = 150;
if ((i == 550) && !*buffer) strcpy(buffer,"Dupe check failed.");
- if (*buffer) if (send_message(i,i == 550,buffer) == -1) return -1;
+ if (*buffer) if (send_message(i,i == 550,buffer,NULL) == -1) return -1;
return i == 550 ? 1 : 0;
}
return 0;
@@ -408,7 +415,7 @@
void cmd_stor_rm(char* fullname, char* dir, char* name)
{ if (add_dir(cwd,dir,fullname,512) == -1) return;
- if (add_dir(fullname,name,fullname,512,0) == -1) return;
+ if (add_dir(fullname,name,fullname,512) == -1) return;
unlink(fullname+1);
}
@@ -455,7 +462,7 @@
client_activity("UPLOAD %s",name);
*(name-1) = '/';
ok = add_dir(cwd,*p,buffer,sizeof(buffer));
- printf("FCO- %li %li %s\n",usr.uid,-2,buffer);
+ printf("FCO- %li %i %s\n",usr.uid,-2,buffer);
fgets(buffer+2048, sizeof(buffer)-2048, stdin);
client_log_start(LG_PUT,"UPLOAD %s",ok == -1 ? *p : buffer);
split_dir(*p,&dir,&name,0);